Skip to content

feat(COD-6201): Docker approach of running the codesec GHA - unified scanning of both SCA and IaC#244

Draft
baltoiteodor wants to merge 11 commits intomainfrom
COD-6201-unified
Draft

feat(COD-6201): Docker approach of running the codesec GHA - unified scanning of both SCA and IaC#244
baltoiteodor wants to merge 11 commits intomainfrom
COD-6201-unified

Conversation

@baltoiteodor
Copy link
Contributor

@baltoiteodor baltoiteodor commented Mar 10, 2026

Linked JIRA issue(s) - Required

https://lacework.atlassian.net/browse/COD-6201

Description

NOTE: At the moment, we launch this with IaC disabled as to make sure we have 1:1 scanning parity for SCA first.

Migrated the GitHub Action from Lacework CLI-based scanner to a Docker-based unified scanner (lacework/codesec:latest).

Changes:

  • Replaced CLI-based scanning with Docker image run via new codesecRun() function in src/util.ts
  • Removed Lacework CLI installation and SCA component installation from action.yaml
  • Removed macOS-specific steps (Docker not pre-installed on macOS runners)
  • Updated artifact structure from root-level files to scan-results/{sca,iac}/ paths
  • Added support for both SCA and IAC scanning in a single unified workflow

Potential Breaking changes:

  • Requires Docker on the runner (use ubuntu-latest)
  • Artifact paths changed from sca.sarif to scan-results/sca/sca-scan.sarif
  • Removed macOS runner support

Tests and additional notes

Integration tests:

  • Updated .github/workflows/integration-test.yml to use single ubuntu-latest runner
  • Removed Java setup (no longer needed)
  • Updated artifact name and path checks
  • Run with: push to main or PR against main

Testing Action on WebGoat, using lacework UEDEMO prod credentials:
PR workflow:
Scenario 1 - Only SCA originated violations: https://github.com/lacework-dev/WebGoat/pull/173
Scenario 2 - Only IaC originated violations: https://github.com/lacework-dev/WebGoat/pull/174
Scenario 3 - Combined violations: https://github.com/lacework-dev/WebGoat/pull/172

Push workflow:
Lacework UI IaC results are under "pipelines" - webgoat repo: https://uedemo.lacework.net/ui/investigation/codesec/iac/assessments/5c2840e6-a3d5-477e-ab34-01799724db40
SCA results not in UI as the scan is not done on main branch.

Notes:

  • The generateUILink() function is not currently being used... will need to add some support to the docker image to include this.

@baltoiteodor baltoiteodor force-pushed the COD-6201-unified branch 4 times, most recently from b5a3559 to ffb930e Compare March 11, 2026 16:27
@baltoiteodor baltoiteodor changed the title do not merge - testing feat(COD-6201): Docker approach of running the codesec GHA - unified scanning of both SCA and IaC Mar 18, 2026
unified scanner docker image

unified scanner docker image

debug + erase macOS runner

debug...

debug testing

clean

add back the generateUILink

clean

added env-file to docker for iac

added env-file to docker for iac

code-scanning-path argument missed
env:
LW_ACCOUNT_NAME: ${{ secrets.LW_ACCOUNT_CAT }}
LW_API_KEY: ${{ secrets.LW_API_KEY_CAT }}
LW_API_SECRET: ${{ secrets.LW_API_SECRET_CAT }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be reverted now that I fixed the SCA scan

Comment on lines +159 to +164
'-e',
`LW_ACCOUNT=${lwAccount}`,
'-e',
`LW_API_KEY=${lwApiKey}`,
'-e',
`LW_API_SECRET=${lwApiSecret}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to do this? Are the environment variables inherited when invoking docker?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Env vars I believe are not inherited and need to be passed to docker.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code then re-introduces the "security issue" addressed in #251

description: 'If a comment was posted, a link to this comment'
value: ${{ steps.run-analysis.outputs.comment-posted }}
runs:
using: 'composite'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use

Suggested change
using: "docker"
image: "docker://lacework/codesec:stable"

here instead of invoking the docker CLI within the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this implies many changes to the docker image. The orchestration logic that currently lives in codesecRun() would need to move into the Docker image's entrypoint and I think some other changes + a redo of this whole PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that using this image means that the running environment can access the scan and compare command directly but I am also not super familiar with the GitHub Actions APIs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative is to include a Dockerfile which inherits from lacework/codesec:stable but also contains the JavaScript code contained in this repository. This is the approach we will need to follow this approach for GitLab.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can have a look at an approach for the docker image inheriting from codesec:stable as this indeed will be what we do for gitlab as well. Two birds with one stone...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants